{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=1001
  Verdict: Accepted
}
var i,n:longint; a:Array[1..1000010] of int64;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l;
j:=r;
x:=a[(l+r) div 2];
repeat
  while a[i]<x do inc(i);
  while a[j]>x do dec(j);
  if i<=j then begin
    y:=a[i];
    a[i]:=a[j];
    a[j]:=y;
    inc(i);
    dec(j);
  end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
qsort(1,n);
if a[n]*a[n-1]*a[n-2]>a[n]*a[1]*a[2] then write(a[n],' ',a[n-1],' ',a[n-2]) else write(a[1],' ',a[2],' ',a[n]);
end.